import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        System.out.println(64-Long.numberOfLeadingZeros(1));
    }
}
class Solution {
    public int[] maximumSumQueries(int[] nums1, int[] nums2, int[][] queries) {
        int n = nums1.length;
        int[][] a = new int[n][2];
        int[] ans = new int[queries.length];
        for(int i=0; i<nums1.length; i++){
            a[i][0] = nums1[i];
            a[i][1] = nums2[i];
        }
        Arrays.sort(a,(x, y)->y[0]-x[0]);

        Integer[] qid = new Integer[queries.length];
        for (int i = 0; i < queries.length; i++) {
            qid[i] = i;
        }
        Arrays.sort(qid, (i, j) -> queries[j][0] - queries[i][0]);

        int j=0;
        List<int[]> st = new ArrayList<>();
        for(int i : qid){
            int x = queries[i][0], y = queries[i][1];
            for(; j<n && a[j][0]>=x; j++){
                while(!st.isEmpty() && st.get(st.size()-1)[1]<a[j][0]+a[j][1]){
                    st.remove(st.size()-1);
                }
                if(st.isEmpty() || st.get(st.size()-1)[0]<a[j][1]){
                    st.add(new int[]{a[j][1], a[j][0]+a[j][1]});
                }
            }
            int p = lowerBound(st, y);
            ans[i] = p<st.size()?st.get(p)[1]:-1;
        }
        return ans;
    }

    private int lowerBound(List<int[]> st, int y){
        int left = 0, right = st.size()-1;
        while(left<=right){
            int mid = (left+right)>>>1;
            if(st.get(mid)[0] >= y){
                right = mid-1;
            }else{
                left = mid+1;
            }
        }
        return right+1;
    }
}
